package leetCode.hw.string;


public class HJ1Solution implements HJ1 {

    @Override
    public int getLastWordLength(String str) {
        int length = str.length();
        int result = 0;
        for(int i=length-1;i>=0;i--){
            if(str.charAt(i)!=' '){
                result++;
            }
            else break;
        }
        return result;
    }

}
